package 蓝桥真题.javab组省赛历年真题.编程题;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class 统计子矩阵 {
        static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        final static int N=90,M=100010;
        static int a[][]=new int[N][M],n,m,limit;
        
        public static void main(String[] ss) throws IOException {
			   ss=br.readLine().split(" ");
			   n=Integer.parseInt(ss[0]);m=Integer.parseInt(ss[1]);
			   long t=System.currentTimeMillis();
			   for(int i=0;i<n;i++){
				   ss=br.readLine().split(" ");
				   for(int j=0;j<m;j++){
					   a[i][j]=Integer.parseInt(ss[j]);
				   }
			   }
			   limit=Integer.parseInt(br.readLine());
			   int res=0;
			   for(int x1=0;x1<n;x1++)
				   for(int y1=0;y1<m;y1++)
					   for(int x2=n-1;x2>=x1;x2--)
						   for(int y2=m-1;y2>=y1;y2--){
							   int max=-0x3f3f3f3f,min=0x3f3f3f3f;
							   if(System.currentTimeMillis()-t>=1000)return;
							   for(int tx=x1;tx<=x2;tx++)
								   for(int ty=y1;ty<=y2;ty++){
									   max=Math.max(max, a[tx][ty]);
									   min=Math.min(min,a[tx][ty]);
								   }
							   if(max-min<=limit){
//								   System.out.println("x1:"+x1+"y1:"+y1+"x2:"+x2+"y2:"+y2);
								   res=Math.max(res,(x2-x1+1)*(y2-y1+1));
							   }
						   }
			   System.out.print(res);
		}
        
}
